import java.awt.Color;


public class PictureTester
{
   public static void main(String[] args)
   {
      Picture pic1 = new Picture("/Users/locphan/Documents/workspace/Lab9/src/butterfly.jpg");
      Picture pic = new Picture("/Users/locphan/Documents/workspace/Lab9/src/butterfly.jpg");
      //Picture modPic = new Picture("caterpillar.jpg");
      
      Pixel[] pixels = pic.getPixels();
      
      //int value = 0;
      for(Pixel pix: pixels)
      {
         int redValue = pix.getRed();
         int greenValue = pix.getGreen();
         int blueValue = pix.getBlue();
         
         int intensity = (redValue+blueValue+greenValue)/3;
         
         //Color negativeColor = new Color (255 - redValue,
         //     255 - greenValue, 255 - blueValue);
         
         Color grayscale = new Color(intensity,intensity,intensity);
         
         //pix.setColor(negativeColor);
         pix.setColor(grayscale);
         
      }
      pic1.show();
      pic.show();
      
   }
}
